package org.sheriff.cfi.model.dao;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

import org.sheriff.cfi.util.DBConnection;
import org.sheriff.cfi.vo.AnalysisRequestVO;

public class AnalysisRequestDAO {

	
	public void insertAnalysisRequest(AnalysisRequestVO arvo)
	{
		try
		{
			
			
				
			Connection dbConnection=null;
			Statement statement = null;
	 
			String insertTableSQL = "INSERT INTO SYS.ANALYSIS_REQUEST (CASE_NUMBER,CASE_TITLE,CASE_DETECTIVE_OFFICER,REQUEST_DATE, ADDRESS,STATE,ZIP_CODE,EMAIL,CASE_TYPE,EVIDENCE_TYPE,BRIEF_DESCRIPTION,ANALYSIS_REQUESTED)"+
			"VALUES ('"+arvo.getCaseNumber()+"','"+arvo.getCaseType()+"','"+arvo.getCaseDetectiveOfficer()+"','"+arvo.getRequestDate()+"','"+arvo.getAddress()+"','"+arvo.getState()+"','"+arvo.getZipcode()+"','"+arvo.getEmail()+"','"+arvo.getCaseType()+"','cellphone','"+arvo.getBriefDescription()+"','"+arvo.getAnalysisRequested()+"')";
					
	 		
			
			try {
				DBConnection dbc= new DBConnection();
				dbConnection=(Connection)dbc.doConnection();
				if(dbConnection!=null)
				{
				statement = dbConnection.createStatement();
	 
				System.out.println(insertTableSQL);
	 
				// execute insert SQL stetement
				statement.executeUpdate(insertTableSQL);
	 
				System.out.println("Record is inserted into ANALYSIS_REQUEST table!");
			}
	 
			} catch (SQLException e) {
	 
				System.out.println(e.getMessage());
	 
			} finally {
	 
				if (statement != null) {
					statement.close();
				}
	 
				if (dbConnection != null) {
					dbConnection.close();
				}
	 
			}

			
			
			
			
			
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
	}
	
}
